#第一题
# class Solution:
#     def lemonadeChange(self, bills: list[int]) -> bool:
#         five = ten = 0
#         for v in bills:
#             if v == 5:
#                 five += 1
#             elif v == 10:
#                 five -= 1
#                 ten += 1
#             else:
#                 if ten > 0:
#                     ten -= 1
#                     five -= 1
#                 else:
#                     five -= 3
#             if five < 0:
#                 return False
#         return True
#第二题
# class Solution:
#     def threeSum(self, nums: list[int]) -> list[list[int]]:
#         nums.sort()  # 对数组进行排序
#         res = []  # 存储结果的列表
#         for i in range(len(nums)-2):
#             if i > 0 and nums[i] == nums[i-1]:  #避免重复的i出现
#                 continue
#             left, right = i+1, len(nums)-1  # 设置左指针和右指针
#             while left < right:  #左右指针正常时
#                 sum = nums[i] + nums[left] + nums[right]
#                 if sum == 0:    #当三数和为0时
#                     res.append([nums[i], nums[left], nums[right]])  #添加到res列表
#                     while left < right and nums[left] == nums[left+1]:  #避免重复的j
#                         left += 1
#                     while left < right and nums[right] == nums[right-1]: #避免重复的k
#                         right -= 1
#                     left += 1   #符合条件则左指针向右移，右指针向左移
#                     right -= 1
#                 elif sum < 0:   #当sum比0小，则加大左指针
#                     left += 1
#                 else:   #当sum比0大则减小右指针
#                     right -= 1
#         return res
#第三题
# class Solution:
#     def largestNumber(self, nums: list[int]) -> str:
#         n = len(nums)
#         nums = list(map(str, nums))
#         for i in range(n):
#             for j in range(i + 1, n):
#                 if nums[i] + nums[j] < nums[j] + nums[i]:
#                     nums[i], nums[j] = nums[j], nums[i]
#         return str(int("".join(nums)))
